package com.wwj.tem.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode;
import com.wwj.tem.common.Result;
import com.wwj.tem.exception.BusinessException;
import com.wwj.tem.service.impl.SysUserServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: wwj
 * @create: 2024/7/28 - 17:30
 * Description:
 */
@RestController
@RequestMapping("/sys/user")
@Api(tags = "系统用户接口")
public class SysUserController {
	
	@Resource
	private SysUserServiceImpl userService;
	
	@ApiOperation("查询所有用户")
	@GetMapping("/search/all")
	@SaCheckPermission("sys:user:read")
	public Result searchAll() {
		return Result.data(userService.all());
	}
	
	@ApiOperation("根据id查询用户")
	@GetMapping("/search/{id}")
	@SaCheckPermission("sys:user:read")
	public Result searchById(@PathVariable String id) {
		return Result.data(userService.getById(id));
	}
	
}
